import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PaymentTypeVO, PaymentTypeForm, PaymentTypeQuery } from '@/api/apartment/attribute/paymentType/types';

/**
 * 查询支付方式列表
 * @param query
 * @returns {*}
 */

export const listPaymentType = (query?: PaymentTypeQuery): AxiosPromise<PaymentTypeVO[]> => {
  return request({
    url: '/apartment/paymentType/list',
    method: 'post',
    data: query
  });
};

/**
 * 查询支付方式详细
 * @param id
 */
export const getPaymentType = (id: string | number): AxiosPromise<PaymentTypeVO> => {
  return request({
    url: '/apartment/paymentType/' + id,
    method: 'get'
  });
};

/**
 * 新增支付方式
 * @param data
 */
export const addPaymentType = (data: PaymentTypeForm) => {
  return request({
    url: '/apartment/paymentType',
    method: 'post',
    data: data
  });
};

/**
 * 修改支付方式
 * @param data
 */
export const updatePaymentType = (data: PaymentTypeForm) => {
  return request({
    url: '/apartment/paymentType',
    method: 'put',
    data: data
  });
};

/**
 * 删除支付方式
 * @param id
 */
export const delPaymentType = (id: string | number | Array<string | number>) => {
  return request({
    url: '/apartment/paymentType/' + id,
    method: 'delete'
  });
};
